package 力扣_链表.中等;


public class 奇偶链表_328 {
    /**
     * @return 根据题目示例看代码,挺好理解的
     */
    public ListNode oddEvenList(ListNode head) {
        if(head == null){
            return head;
        }
        ListNode oHead = head.next;
        ListNode jNode = head;
        ListNode oNode = oHead;
        while(oNode != null && oNode.next != null){
            jNode.next = oNode.next;
            jNode = jNode.next;
            oNode.next = jNode.next;
            oNode = oNode.next;
        }
        jNode.next = oHead;
        return head;
    }
}
class ListNode {
    int val;
    ListNode next;
    ListNode(int val){
        this.val = val;
        next = null;
    }
}
